#include "ros/ros.h"
#include "std_msgs/Header.h"
#include "sine_generator/SignalValue.h"

#include "sine_generator.hpp"

/**
 * This tutorial demonstrates simple sending of messages over the ROS system.
 */
int main(int argc, char **argv)
{
    SineGenerator sg;

    ros::init(argc, argv, "sine_generator_publisher");

    /**
     * NodeHandle is the main access point to communications with the ROS system.
     * The first NodeHandle constructed will fully initialize this node, and the last
     * NodeHandle destructed will close down the node.
     */
    ros::NodeHandle n;

    /**
     * Declare publisher, create publisher 'signal_value' using the 'sine_generator::SignalValue'
     * message file from the 'sine_generator' package. The topic name is
     * 'signal_value' and the size of the publisher queue is set to 1000.
     */
    ros::Publisher chatter_pub = n.advertise<sine_generator::SignalValue>("signal_value", 1000);

    // Set the loop period. '10' refers to 10 Hz and the main loop repeats at 0.1 second intervals
    ros::Rate loop_rate(10);

    long i = 0;
    while(ros::ok())
    {
        sine_generator::SignalValue msg;
        
        msg.header.seq = i++;
        msg.header.stamp = ros::Time::now();
        msg.header.frame_id = "sine_generator";

        //------------------------------------------------
        // TODO: write your codes here, between the lines





        //------------------------------------------------

        ros::spinOnce();
        loop_rate.sleep();
    }

    return 0;
}